package com.jcl.cloud.services.crawler.search.config;


import com.jcl.cloud.services.brain.client.CrawlerBrainClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class SearchConfig {




    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }


    @Bean
    @ConditionalOnBean(RestTemplate.class)
    public CrawlerBrainClient crawlerBrainClient(RestTemplate restTemplate) {
        return new CrawlerBrainClient(restTemplate);
    }




}
